﻿using mscook.core.domain;
using mscook.core.repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mscook.core.services
{
    public class BaseService<T> : IBaseService<T>  where T: BaseObject
    {
        private IRepository<T> repository;

        public BaseService(IRepository<T> repository)
        {
            this.repository = repository;
        }
        public T Get(string id)
        {
            return repository.Get(id);
        }
        public void SaveOrUpdate(T entity)
        {
            repository.SaveOrUpdate(entity);
        }
        public void Update(T entity)
        {
            repository.Update(entity);
        }
        public bool Delete(string id)
        {
            return repository.Delete(id);
        }
        public IList<T> SelectPageList(int start, int limit, out long total)
        {
            return repository.SelectPageList(start, limit, out total);
        }

    }
}
